package com.hxht.cmp.controller;

import com.hxht.cmp.common.enums.ResultCode;
import com.hxht.cmp.common.result.ResultResponse;
import com.hxht.cmp.service.CourtStatusService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/courtStatus")
public class CourtStatusController {
    @Autowired
    private CourtStatusService courtStatusService;

    /**
     * 法庭状态
     * @param courtUid
     * @return
     */
    @RequestMapping("/selectCourtStatusList")
    @ResponseBody
    public ResultResponse selectCourtStatusList(String courtUid) {
        if (StringUtils.isBlank(courtUid)) {
            return ResultResponse.failed(ResultCode.PARAMETER_NULL);
        }
        List<Map<String, Object>> mapList = courtStatusService.selectCourtStatusList(courtUid);
        if (null != mapList) {
            return ResultResponse.success(mapList);
        }
        return ResultResponse.failed(ResultCode.SERVER_ERROR);
    }

    /**
     * 法庭录制情况
     * @param courtUid
     * @return
     */
    @RequestMapping("/selectVideoStatus")
    @ResponseBody
    public  ResultResponse selectVideoStatus(String courtUid){
        if (StringUtils.isBlank(courtUid)){
            return  ResultResponse.failed(ResultCode.PARAMETER_NULL);
        }
        List<Map<String, Object>> mapList= courtStatusService.selectVideoStatus(courtUid);
        return ResultResponse.success(mapList);
    }
}
